package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
import android.widget.TextView;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.css.CSSDeclaration;
import com.huawei.appgallery.foundation.ui.css.adapter.CSSPropertyName;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSMonoColor;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSValue;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.framework.widget.CustomActionBar;
import com.huawei.appmarket.framework.widget.RenderImageView;
import com.huawei.appmarket.framework.widget.RenderImageView.b;
import com.huawei.appmarket.service.store.awk.bean.ImmersiveHeadThemeCardBean;
import o.azb;
import o.cgz;
import o.Logger;
import o.eqx;
import o.eqz;
import o.erq;
import o.ewm.d;
import o.ewm.j;

public class ImmersiveHeadThemeCard extends BaseDistCard implements eqz, b {
    private boolean ʻ = false;
    private TextView ʼ;
    private String ʽ;
    private RenderImageView ˋ;
    private TextView ॱॱ;
    private TextView ᐝ;

    public ImmersiveHeadThemeCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ˋ = (RenderImageView) view.findViewById(j.ˋꜝ);
        this.ʼ = (TextView) view.findViewById(j.ˎי);
        this.ॱॱ = (TextView) view.findViewById(j.ˍͺ);
        this.ᐝ = (TextView) view.findViewById(j.ˌʽ);
        azb.ॱ(this.ᐝ);
        this.ˋ.setListener(this);
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        ImmersiveHeadThemeCardBean immersiveHeadThemeCardBean = (ImmersiveHeadThemeCardBean) cardBean;
        if (immersiveHeadThemeCardBean.ॱ() != null) {
            this.ʼ.setText(immersiveHeadThemeCardBean.ॱ());
        }
        if (immersiveHeadThemeCardBean.ʽ() != null) {
            this.ॱॱ.setText(immersiveHeadThemeCardBean.ʽ());
        }
        if (immersiveHeadThemeCardBean.ꜟ() != null) {
            this.ᐝ.setVisibility(0);
            this.ᐝ.setText(immersiveHeadThemeCardBean.ꜟ());
        }
        this.ʽ = immersiveHeadThemeCardBean.ᶥ();
        eqx.ˎ(this.ˋ, immersiveHeadThemeCardBean.ˊ(), "image_default_icon", this, true);
    }

    public void ॱ(Bitmap bitmap) {
        if (bitmap != null) {
            try {
                int ॱ = erq.ॱ(this.ʽ, bitmap);
                this.ˋ.setRenderColor(ॱ);
                this.ˋ.setRenderScale(0.3f);
                if (!this.ʻ) {
                    CustomActionBar.ˎ(this.ˋ.getContext(), ॱ, this.ˋ.getHeight());
                    boolean ˏ = erq.ˏ(ॱ);
                    ॱ = -16777216;
                    this.ॱॱ.setAlpha(azb.ˋ(this.ʼॱ, d.ߺ));
                    if (ˏ) {
                        ॱ = -1;
                        this.ॱॱ.setAlpha(azb.ˋ(this.ʼॱ, d.ॱʿ));
                    }
                    this.ʼ.setTextColor(ॱ);
                    this.ॱॱ.setTextColor(ॱ);
                    this.ʻ = false;
                }
            } catch (IllegalStateException e) {
                Logger.e("ImmersiveHeadThemeCard", e.toString());
            }
        }
    }

    public boolean ˋ(CSSDeclaration cSSDeclaration) {
        CSSValue propertyValue = cSSDeclaration.getPropertyValue(CSSPropertyName.FONT_COLOR);
        if (propertyValue != null && (propertyValue instanceof CSSMonoColor)) {
            this.ʻ = true;
        }
        return false;
    }
}
